/**
 * Dart中的对象操作符：
 *  ? 条件运算符（了解）
 *  as 类型转换
 *  is 类型判断
 *  .. 级联操作 (连缀)
 */
class Person {
  String name;
  num age;
  Person(this.name, this.age);
  void printInfo() {
    print("${this.name} ------ ${this.age}");
  }
}

main(List<String> args) {
  Person p;
  p?.printInfo();
  Person pp = new Person("张三", 20);
  if (pp is Person) {
    pp.name = "曾卓";
  }
  pp.printInfo();
  print(pp is Object);

  var p1;
  // p1 = "";
  p1 = new Person("andrew", 30);
  p1.printInfo();
  (p1 as Person).printInfo();
  p1
    ..name = '李四'
    ..age = 50
    ..printInfo();
}
